
<script type="text/javascript">

formcheckLanguage = {
    required: "<s:text name="jr.errors.required"></s:text>",
    alpha: "<s:text name="jr.errors.alpha"></s:text>",
    alphanum: "<s:text name="jr.errors.alphanum"></s:text>",
    nodigit: "<s:text name="jr.errors.nodigit"></s:text>",
    digit: "<s:text name="jr.errors.digit"></s:text>",
    digitmin: "<s:text name="jr.errors.digitmin"></s:text>",
    digitltd: "<s:text name="jr.errors.digitltd"></s:text>",
    number: "<s:text name="jr.errors.number"></s:text>",
    email: "<s:text name="jr.errors.email.format"></s:text>",
    phone: "<s:text name="jr.errors.phone.format"></s:text>",
    url: "<s:text name="jr.errors.url.format"></s:text>",

    confirm: "<s:text name="jr.errors.password.format"></s:text>",
    differs: "<s:text name="jr.errors.differs"></s:text>",
    length_str: "<s:text name="jr.errors.length_str"></s:text>",
    lengthmax: "<s:text name="jr.errors.lengthmax"></s:text>",
    lengthmin: "<s:text name="jr.errors.lengthmin"><s:param><s:text name="user.password.lengthmin"/></s:param></s:text>",
    checkbox: "<s:text name="jr.errors.checkbox.format"></s:text>",
    radios: "<s:text name="jr.errors.radios.format"></s:text>",
    select: "<s:text name="jr.errors.select.format"></s:text>"
}

window.addEvent('domready', function() {

    var dynCount = 0;
    var emailSta = true;
    var idcardSta = true;
    var emailMsg;
    var ut = 0;
    $('userType').value = 0;

    var unameval = $("usernameval");
    unameval.disabled = false;

    unameval.addEvent("click", function(e) {
        e = new Event(e).stop();
        var uname = $('user_username').value;
        if (!$chk(uname)) {
            showMsg($('m_t').value, $('m_b').value);
        } else {
            unameval.value = $('btning').value;
            unameval.disabled = true;
            new Json.Remote("/chkuname.html?ajax=true", {
                method:'post',
                onComplete:function(jsonobj) {
                    showMsg(jsonobj.msgTitle, jsonobj.msgBody);
                    unameval.value = $('btn').value;
                    unameval.disabled = false;
                }
            }).send({'username':uname});
        }
    });

    $('ug_person').addEvent('click', function() {
        $('userType').value = 0;
    });
    $('ug_company').addEvent('click', function() {
        $('userType').value = 1;
    });
    $('ug_team').addEvent('click', function() {
        $('userType').value = 2;
    });
    $('ug_goverment').addEvent('click', function() {
        $('userType').value = 3;
    });

    $('user_email').addEvent('blur', function() {
        var j_email = $('user_email').value;
        if (!$chk(j_email))return;
        if ($chk(j_email)) {
            var reg = /^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/i;
            var r = j_email.test(reg);
            if (!r)return;
        }
        new Json.Remote("/chkemail.html?ajax=true", {
            method:'post',
            onComplete:function(jsonobj) {
                emailMsg = jsonobj.msgBody;
                if (jsonobj.isSuccess == "false") {
                    showMsg(jsonobj.msgTitle, emailMsg);
                    $('signup_btn').disabled = true;
                    emailSta = false;
                    email_idcard_back();
                }
                if (jsonobj.isSuccess == "true") {
                    emailSta = true;
                    $('signup_btn').disabled = false;
                    email_idcard_back();
                }
            }
        }).send({'email':$('user_email').value});
    });

    function showMsg(msgTitle, msgBody) {
        var mbox = $("messagebox");
        var mboxfx = new Fx.Style(mbox, 'opacity', {duration:500});
        var mesp = $E(".mes", mbox);
        $E(".title", mbox).setHTML(msgTitle);
        mesp.setHTML(msgBody);
        mbox.setStyles({
            'display':'block',
            'opacity':0,
            'width':250
        });
        setPositionToCenter(mbox);
        mboxfx.start(1);
        mbox.addEvent("click", function() {
            var fx = new Fx.Styles(this, {duration:800,transition:Fx.Transitions.Back.easeIn});
            fx.start({'top':0,'opacity':[1,0]}).chain(function() {
                mbox.setStyle('display', 'none');
            });
        });
    }

    function getw() {
        var wc = (window.getWidth() + window.getScrollLeft()) / 2;
        var hc = (window.getHeight() + window.getScrollTop()) / 2;
        return {'x':wc,'y':hc};
    }

    function setPositionToCenter(el) {
        if (el.getStyle("display") != "none")
            el.setStyles({
                'left':getw().x - (el.getCoordinates().width) / 2,
                'top':getw().y - (el.getCoordinates().height)
            });
    }

    var isbig = new Fx.Slide('isbasebig');
    isbig.hide();
    var plant = $('plant');
    var plantn = $('plantn');
    plant.addEvent('click', function(e) {
        e = new Event(e);
        $('plantv').checked = true;
        isbig.slideIn();
        e.stop();
    });
    plantn.addEvent('click', function(e) {
        e = new Event(e);
        $('plantnv').checked = true;
        isbig.slideOut();
        e.stop();
    });

    var first = new Fx.Slide('first');
    var uinfo = new Fx.Slide('userinfo');
    uinfo.hide();

    [$("next"),$('pre')].each(function(item, index) {
        var aFX = new Fx.Style(item, "margin-left", {duration:200});
        item.addEvent('mouseenter', function() {
            if (item.id == "pre")
                aFX.start(10, 2);
            aFX.start(18);
        });
        item.addEvent('mouseleave', function() {
            aFX.start(10);
        });

        item.addEvent('click', function(e) {
            e = new Event(e);
            if (item.id == "next") {
                dynacontent();
                formcheck();
                first.slideOut();
                uinfo.slideIn();
            } else {
                clear();
                uinfo.slideOut();
                first.slideIn();
            }
            e.stop();
        });
    });

    var li_dyn = $('li_dyna');
    var dyna = $('dynacontent');
    var clear = function() {
        dyna.empty();
        dynCount = 0;
        $ES('div[id^=diverror]').each(function(item, index) {
            item.empty();
        });
        $('li_dyna').empty();
        $('signup_btn').disabled = false;
        $('email_idcard').setHTML("<s:text name="signup.welcome.message"></s:text>").removeClass("req");
        $('add_label').setHTML("<s:text name="user.address.address"></s:text>");
    }
    var el_posistion = function(el) {
        if (dynCount > 0)
            el.injectAfter(dyna.getLast());
        else
            el.injectInside(dyna);
    }

    var formcheck = function() {
        check = null;
        check = new FormCheck('signupForm', {
            display : {
                fadeDuration : 500,
                errorsLocation : 1,
                indicateErrors : 1,
                showErrors : 1,
                tipsOffsetY:130
            }
        })
    }

    var dynacontent = function() {
				ut = $('userType').value;
        //person
        if (ut == "0") {
            personDyna();
            if ($('person_icreg').checked) {
                icregAbout();
            }
            personInfoAbout();
        }

    	//company
        if (ut == "1") {
            companyDyna();
            company_team_gov_contactinfo();
        }

    	//team
        if (ut == "2") {
            teamDyna();
            if ($('team_groupIcReg').checked) {
                icregAbout();
            }
            if ($('team_groupBase').checked) {
                plantAbout("<s:text name="team.plant.message"></s:text>"
                        , 'teamInfo.plantAreaSqm', 'teamInfo.plantAreaMu', 'teamInfo.plantInfo', true);
            }
            company_team_gov_contactinfo();
        }

    	//goverment
        if (ut == "3") {
            govermentDyna();
            if ($('goverment_groupBase').checked) {
                plantAbout("<s:text name="goverment.plant.message"></s:text>"
                        , 'govermentInfo.plantAreaSqm', 'govermentInfo.plantAreaMu', 'govermentInfo.plantInfo', true)
            }
            company_team_gov_contactinfo();
        }

    }

    var personDyna = function() {
        var p_li = new Element('li', { 'class': 'info infos'}).setHTML("<s:text name="signup.person.message"></s:text>").injectInside(li_dyn);

        var p_name_li = new Element('li').injectAfter(p_li);
        var p_name_div = new Element('div').injectInside(p_name_li);

					//user.lastName
        var lastName_div = new Element('div', {'class':'left'}).injectInside(p_name_div);
        var lastName_label = new Element('label', {'for':'lastName','class':'desc'})
                .setHTML("<s:text name="user.lastName"></s:text>")
                .injectInside(lastName_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(lastName_label);
        var lastName_input = new Element('input', {'type':'text','title':'<s:text name="signup.user.lastName.title"></s:text>','name':'user.lastName','id':'lastName','class':'text medium'}).injectAfter(lastName_label);
        lastName_input.addClass("validate['required','nodigit']");
        newTip(lastName_input);
					//user.firstName
        var firstName_div = new Element('div').injectAfter(lastName_div);
        var firstName_label = new Element('label', {'for':'firstName','class':'desc'})
                .setHTML("<s:text name="user.firstName"></s:text>")
                .injectInside(firstName_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(firstName_label);
        var firstName_input = new Element('input', {'type':'text','title':'<s:text name="signup.user.firstName.title"></s:text>','name':'user.firstName','id':'firstName','class':'text medium'}).injectAfter(firstName_label);
        firstName_input.addClass("validate['required','nodigit']");
        newTip(firstName_input);
					//sex
        var sex_div = new Element('div').injectAfter(firstName_div);
        var sex_label = new Element('label', {'class':'desc'}).setHTML("<s:text name="user.sex"></s:text>").injectInside(sex_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(sex_label);

        var sex_male_div = new Element('div', {'class':'left'}).injectAfter(sex_label);
        var sex_male_label = new Element('label', {'for':'male'}).setHTML("<s:text name="user.sex.male"></s:text>").injectInside(sex_male_div);
        var sex_male_input = new Element('input', {'type':'radio','name':'sex','id':'male','value':'0'}).injectAfter(sex_male_label);

        var sex_female_div = new Element('div').injectAfter(sex_male_div);
        var sex_female_label = new Element('label', {'for':'female'}).setHTML("<s:text name="user.sex.female"></s:text>").injectInside(sex_female_div);
        var sex_female_input = new Element('input', {'type':'radio','name':'sex','id':'female','value':'1'}).injectAfter(sex_female_label);
        sex_female_input.addClass("validate['required']");
					//idcard
        var idcard_div = new Element('div').injectAfter(sex_div);
        var idcard_label = new Element('label', {'for':'idcard','class':'desc'})
                .setHTML("<s:text name="user.idcard"></s:text>")
                .injectInside(idcard_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(idcard_label);
        var idcard_input = new Element('input', {'type':'text','name':'user.idcard','id':'idcard','class':'text large'}).injectAfter(idcard_label);
        var idcard_span = new Element('span', {'id':'idcard_span'}).injectAfter(idcard_input);
        idcard_input.addClass("validate['required','alphanum']");
        idcard_input.addEvent('blur', function() {
            var idcard = $('idcard').value;
            if ($chk(idcard)) {
                var reg = /^\d{15}(\d{2}[A-Za-z0-9])?$/;
                var r = idcard.match(reg);
                if (r == null) {
                    var idcard_f_m = "<s:text name="errors.idcard.format"></s:text>";
                    showMsg($('m_t').value, idcard_f_m);
                    $('signup_btn').disabled = true;
                    idcardSta = false;
                    email_idcard_back();
                    return;
                }
            }
            idcardSta = true;
            $('signup_btn').disabled = false;
            email_idcard_back();
        });

		    	//address
        $('add_label').setHTML("<s:text name="user.address.person.address"></s:text>");

        mobile_url_(idcard_div);
    }

    var mobile_url_ = function(after) {
        //user.phoneNumber
        var phoneNumber_div = new Element('div').injectAfter(after);
        var phoneNumber_label = new Element('label', {'for':'phoneNumber','class':'desc'})
                .setHTML("<s:text name="user.phoneNumber"></s:text>")
                .injectInside(phoneNumber_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(phoneNumber_label);
        var phoneNumber_input = new Element('input', {'type':'text','name':'user.phoneNumber','id':'phoneNumber','class':'text medium'}).injectAfter(phoneNumber_label);
        phoneNumber_input.addClass("validate['required','phone']");
    			//user.mobile
        var mobile_div = new Element('div').injectAfter(phoneNumber_div);
        var mobile_label = new Element('label', {'for':'mobile','class':'desc'})
                .setHTML("<s:text name="user.mobile"></s:text>")
                .injectInside(mobile_div);
        var mobile_input = new Element('input', {'type':'text','title':'<s:text name="signup.user.mobile.title"></s:text>','name':'user.mobile','id':'mobile','class':'text medium'}).injectAfter(mobile_label);
        mobile_input.addClass("validate['phone']");
        newTip(mobile_input);
					//user.mobilePub
        var mobile_radio_label = new Element('label', {'for':'mobile_radio_y'}).setHTML("<s:text name="signup.ispublic"></s:text>" + "  ").injectInside(mobile_div);

        var mobile_radio_y_label = new Element('label', {'for':'mobile_radio_y'}).setHTML("<s:text name="signup.yes"></s:text>").injectAfter(mobile_radio_label);
        var mobile_radio_y_input = new Element('input', {'type':'radio','title':'<s:text name="signup.ispublic.title"></s:text>','name':'user.mobilePub','id':'mobile_radio_y','value':'true'}).injectAfter(mobile_radio_y_label);
        newTip(mobile_radio_y_input);
        var mobile_radio_n_label = new Element('label', {'for':'mobile_radio_n'}).setHTML("<s:text name="signup.no"></s:text>").injectAfter(mobile_radio_y_input);
        var mobile_radio_n_input = new Element('input', {'type':'radio','title':'<s:text name="signup.ispublic.title"></s:text>','name':'user.mobilePub','id':'mobile_radio_n','value':'false'}).injectAfter(mobile_radio_n_label);
        newTip(mobile_radio_n_input);

					//user.website
        var website_div = new Element('div', {'class':'left'}).injectInside(mobile_div);
        var website_label = new Element('label', {'for':'website','class':'desc'})
                .setHTML("<s:text name="user.website"></s:text>")
                .injectInside(website_div);
        var website_input = new Element('input', {'type':'text','name':'user.website','id':'website','class':'text medium'}).injectAfter(website_label);
        website_input.addClass("validate['url']");
					//user.faxNo
        var faxNo_div = new Element('div').injectAfter(website_div);
        var faxNo_label = new Element('label', {'for':'faxNo','class':'desc'})
                .setHTML("<s:text name="user.faxNo"></s:text>")
                .injectInside(faxNo_div);
        var faxNo_input = new Element('input', {'type':'text','name':'user.faxNo','id':'faxNo','class':'text medium'}).injectAfter(faxNo_label);

    }

    var email_idcard_back = function() {
        var ei = $('email_idcard');
        if (!emailSta) {
            ei.setHTML(emailMsg).addClass("req");
            return;
        }
        if (!idcardSta) {
            ei.setHTML("<s:text name="errors.idcard.format"></s:text>").addClass("req");
            return;
        }
        if (emailSta && idcardSta) {
            ei.setHTML("<s:text name="signup.welcome.message"></s:text>").removeClass("req");
        }
    }

    var company_team_gov_contactinfo = function() {
        var contact_li_msg = new Element('li', { 'class': 'info infos'})
                .setHTML("<s:text name="signup.contact.message"></s:text>");
        el_posistion(contact_li_msg);

        var c_con_li = new Element('li').injectAfter(contact_li_msg);
        var c_con_div = new Element('div').injectInside(c_con_li);
    		//user.contactName
        var contactName_div = new Element('div', {'class':'left'}).injectInside(c_con_div);
        var contactName_label = new Element('label', {'for':'contactName','class':'desc'})
                .setHTML("<s:text name="user.contactName"></s:text>")
                .injectInside(contactName_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(contactName_label);
        var contactName_input = new Element('input', {'type':'text','name':'user.contactName','id':'contactName','class':'text medium'}).injectAfter(contactName_label);
        contactName_input.addClass("validate['required']");
					//user.contactDept
        var contactDept_div = new Element('div').injectAfter(contactName_div);
        var contactDept_label = new Element('label', {'for':'contactDept','class':'desc'})
                .setHTML("<s:text name="user.contactDept"></s:text>")
                .injectInside(contactDept_div);
        var contactDept_input = new Element('input', {'type':'text','name':'user.contactDept','id':'contactDept','class':'text medium'}).injectAfter(contactDept_label);

					//sex
        var sex_div = new Element('div').injectAfter(contactDept_div);
        var sex_label = new Element('label', {'class':'desc'}).setHTML("<s:text name="user.sex"></s:text>").injectInside(sex_div);
				var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(sex_label);

        var sex_male_div = new Element('div', {'class':'left'}).injectAfter(sex_label);
        var sex_male_label = new Element('label', {'for':'male'}).setHTML("<s:text name="user.sex.male"></s:text>").injectInside(sex_male_div);
        var sex_male_input = new Element('input', {'type':'radio','name':'sex','id':'male','value':'0'}).injectAfter(sex_male_label);

        var sex_female_div = new Element('div').injectAfter(sex_male_div);
        var sex_female_label = new Element('label', {'for':'female'}).setHTML("<s:text name="user.sex.female"></s:text>").injectInside(sex_female_div);
        var sex_female_input = new Element('input', {'type':'radio','name':'sex','id':'female','value':'1'}).injectAfter(sex_female_label);
        sex_female_input.addClass("validate['required']");
					//user.contactPost
        var contactPost_div = new Element('div', {'class':'left'}).injectAfter(sex_div);
        var contactPost_label = new Element('label', {'for':'contactPost','class':'desc'})
                .setHTML("<s:text name="user.contactPost"></s:text>")
                .injectInside(contactPost_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(contactPost_label);
        var contactPost_input = new Element('input', {'type':'text','name':'user.contactPost','id':'contactPost','class':'text medium'}).injectAfter(contactPost_label);
        contactPost_input.addClass("validate['required']");

        mobile_url_(contactPost_div);
    }

    var companyDyna = function() {
        var c_li = new Element('li', { 'class': 'info infos'}).setHTML("<s:text name="signup.company.message"></s:text>").injectInside(li_dyn);
        icregAbout_(c_li);
				//address
        $('add_label').setHTML("<s:text name="user.address.company.address"></s:text>");
    }

    var teamDyna = function() {
        var t_li = new Element('li', { 'class': 'info infos'}).setHTML("<s:text name="signup.team.message"></s:text>").injectInside(li_dyn);
        team_gov_('<s:text name="user.companyName.team"></s:text>', t_li);
    		//address
        $('add_label').setHTML("<s:text name="user.address.person.address"></s:text>");
    }

    var govermentDyna = function() {
        var g_li = new Element('li', { 'class': 'info infos'}).setHTML("<s:text name="signup.goverment.message"></s:text>").injectInside(li_dyn);
        team_gov_('<s:text name="user.companyName.goverment"></s:text>', g_li);
			  //address
        $('add_label').setHTML("<s:text name="user.address.person.address"></s:text>");
    }

    var team_gov_ = function(labelName, after) {
        var icreg_li = new Element('li').injectAfter(after);
        var icreg_div = new Element('div').injectInside(icreg_li);

    			//companyName
        var companyName_div = new Element('div').injectInside(icreg_div);
        var companyName_label = new Element('label', {'for':'companyName','class':'desc'})
                .setHTML(labelName)
                .injectInside(companyName_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(companyName_label);
        var companyName_input = new Element('input', {'type':'text','name':'user.companyName','id':'companyName','class':'text large'}).injectAfter(companyName_label);
        companyName_input.addClass("validate['required']");
    }

    var plantAbout = function(plant_li_msg, plantAreaSqm_input_name, plantAreaMu_input_name, plantInfo_input_name, plantShow) {
        var plantv_li_msg = new Element('li', { 'class': 'info infos'})
                .setHTML(plant_li_msg);
        el_posistion(plantv_li_msg);

        var plant_li = new Element('li').injectAfter(plantv_li_msg);
        var plant_div = new Element('div').injectInside(plant_li);

					//plantAreaSqm
        var plantAreaSqm_div = new Element('div', {'class':'left'}).injectInside(plant_div);
        var plantAreaSqm_label = new Element('label', {'for':'plantAreaSqm','class':'desc'})
                .setHTML("<s:text name="user.personInfo.plantAreaSqm"></s:text>")
                .injectInside(plantAreaSqm_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(plantAreaSqm_label);
        var plantAreaSqm_input = new Element('input', {'type':'text','name':plantAreaSqm_input_name,'id':'plantAreaSqm','class':'text medium'}).injectAfter(plantAreaSqm_label);
        plantAreaSqm_input.addClass("validate['required']");

					//plantAreaMu
        var plantAreaMu_div = new Element('div').injectAfter(plantAreaSqm_div);
        var plantAreaMu_label = new Element('label', {'for':'plantAreaMu','class':'desc'})
                .setHTML("<s:text name="user.personInfo.plantAreaMu"></s:text>")
                .injectInside(plantAreaMu_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(plantAreaMu_label);
        var plantAreaMu_input = new Element('input', {'type':'text','name':plantAreaMu_input_name,'id':'plantAreaMu','class':'text medium'}).injectAfter(plantAreaMu_label);
        plantAreaMu_input.addClass("validate['required']");

        var floatReg = /^\d+(\.\d+)?$/;
        plantAreaSqm_input.addEvent('change', function() {
            if (plantAreaSqm_input.value.test(floatReg)) {
                var muValue = parseFloat(plantAreaSqm_input.value) * 0.0015;
                plantAreaMu_input.value = muValue.toFixed(2);
            }
        });

        plantAreaMu_input.addEvent('change', function() {
            if (plantAreaMu_input.value.test(floatReg)) {
                var sqmValue = parseFloat($("plantAreaMu").value) * 666.6;
                plantAreaSqm_input.value = sqmValue.toFixed(2);
            }
        });

        if (plantShow) {
            //plantInfo
            var plantInfo_div = new Element('div').injectAfter(plantAreaMu_div);
            var plantInfo_label = new Element('label', {'for':'plantInfo','class':'desc'})
                    .setHTML("<s:text name="user.personInfo.plantInfo"></s:text>")
                    .injectInside(plantInfo_div);
            var plantInfo_input = new Element('textarea', {'cols':'60','rows':'4','name':plantInfo_input_name,'id':'plantInfo','class':'textarea'}).injectAfter(plantInfo_label);
        }

        dynCount++;
    }

    var icregAbout = function() {
        var icreg_li_msg = new Element('li', { 'class': 'info infos'})
                .setHTML("<s:text name="icreg.message"></s:text>");
        el_posistion(icreg_li_msg);

        icregAbout_(icreg_li_msg);

        dynCount++;
    }

    var icregAbout_ = function(after) {
        var icreg_li = new Element('li').injectAfter(after);
        var icreg_div = new Element('div').injectInside(icreg_li);
					//registerId
        var registerId_div = new Element('div', {'class':'left'}).injectInside(icreg_div);
        var registerId_label = new Element('label', {'for':'registerId','class':'desc'})
                .setHTML("<s:text name="user.registerId"></s:text>")
                .injectInside(registerId_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(registerId_label);
        var registerId_input = new Element('input', {'type':'text','name':'user.registerId','id':'registerId','class':'text medium'}).injectAfter(registerId_label);
        registerId_input.addClass("validate['required']");
					//companyName
        var companyName_div = new Element('div').injectAfter(registerId_div);
        var companyName_label = new Element('label', {'for':'companyName','class':'desc'})
                .setHTML("<s:text name="user.companyName"></s:text>")
                .injectInside(companyName_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(companyName_label);
        var companyName_input = new Element('input', {'type':'text','name':'user.companyName','id':'companyName','class':'text medium'}).injectAfter(companyName_label);
        companyName_input.addClass("validate['required']");
					//registerMoney
        var registerMoney_div = new Element('div', {'class':'left'}).injectAfter(companyName_div);
        var registerMoney_label = new Element('label', {'for':'registerMoney','class':'desc'})
                .setHTML("<s:text name="user.registerMoney"></s:text>")
                .injectInside(registerMoney_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(registerMoney_label);
        var registerMoney_input = new Element('input', {'type':'text','name':'user.registerMoney','id':'registerMoney','class':'text medium'}).injectAfter(registerMoney_label);
        registerMoney_input.addClass("validate['required']");
					//registerCapital
        var registerCapital_div = new Element('div').injectAfter(registerMoney_div);
        var registerCapital_label = new Element('label', {'for':'registerCapital','class':'desc'})
                .setHTML("<s:text name="user.registerCapital"></s:text>")
                .injectInside(registerCapital_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(registerCapital_label);
        var registerCapital_input = new Element('input', {'type':'text','name':'user.registerCapital','id':'registerCapital','class':'text medium'}).injectAfter(registerCapital_label);
        registerCapital_input.addClass("validate['required']");

					//registerYear
        var registerYear_div = new Element('div').injectAfter(registerCapital_div);
        var registerYear_label = new Element('label', {'for':'registerYear','class':'desc','size':'11','title':'date'})
                .setHTML("<s:text name="user.registerYear"></s:text>")
                .injectInside(registerYear_div);
        var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(registerYear_label);
        var registerYear_input = new Element('input', {'type':'text','name':'user.registerYear','id':'registerYear','class':'text medium'}).injectAfter(registerYear_label);
        var reigsterYear_img = new Element('img', {'id':'reigsterYear_img','src':'/images/iconCalendar.gif','alt':'Select Date'}).injectAfter(registerYear_input);
        registerYear_input.addClass("validate['required']");
        Calendar.setup({inputField: "registerYear", ifFormat: "%Y-%m-%d", button: "reigsterYear_img"});
    }

    var personInfoAbout = function() {

        if ($('plantv').checked) {
            plantAbout("<s:text name="person.plant.message"></s:text>"
                    , 'personInfo.plantAreaSqm', 'personInfo.plantAreaMu', 'personInfo.plantInfo', !$('person_base').checked)
        }
        ;


        if ($('person_broker').checked) {

            var broker_li_msg = new Element('li', { 'class': 'info infos'})
                    .setHTML("<s:text name="person.broker.message"></s:text>");
            el_posistion(broker_li_msg);

            var broker_li = new Element('li').injectAfter(broker_li_msg);
            var broker_div = new Element('div').injectInside(broker_li);

    			//personInfo.brokerItems
            var brokerItems_div = new Element('div').injectInside(broker_div);
            var brokerItems_label = new Element('label', {'for':'brokerItems','class':'desc'})
                    .setHTML("<s:text name="user.personInfo.brokerItems"></s:text>")
                    .injectInside(brokerItems_div);
            var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(brokerItems_label);
            var brokerItems_input = new Element('input', {'type':'text','name':'personInfo.brokerItems','id':'brokerItems','class':'text medium'}).injectAfter(brokerItems_label);
            brokerItems_input.addClass("validate['required']");
					//personInfo.brokerInfo
            var brokerInfo_div = new Element('div').injectAfter(brokerItems_div);
            var brokerInfo_label = new Element('label', {'for':'brokerInfo','class':'desc'})
                    .setHTML("<s:text name="user.personInfo.brokerInfo"></s:text>")
                    .injectInside(brokerInfo_div);
            var brokerInfo_input = new Element('textarea', {'cols':'60','rows':'4','name':'personInfo.brokerInfo','id':'brokerInfo','class':'textarea'}).injectAfter(brokerInfo_label);

            dynCount++;
        }

        if ($('person_expert').checked) {
            var expert_li_msg = new Element('li', { 'class': 'info infos'})
                    .setHTML("<s:text name="person.expert.message"></s:text>");
            el_posistion(expert_li_msg);

            var expert_li = new Element('li').injectAfter(expert_li_msg);
            var expert_div = new Element('div').injectInside(expert_li);

					//personInfo.expertItems
            var expertItems_div = new Element('div').injectInside(expert_div);
            var expertItems_label = new Element('label', {'for':'expertItems','class':'desc'})
                    .setHTML("<s:text name="user.personInfo.expertItems"></s:text>")
                    .injectInside(expertItems_div);
            var req = new Element('span', {'class':'req'}).setHTML(" *").injectInside(expertItems_label);
            var expertItems_input = new Element('input', {'type':'text','name':'personInfo.expertItems','id':'expertItems','class':'text medium'}).injectAfter(expertItems_label);
            expertItems_input.addClass("validate['required']");
					//personInfo.resume
            var resume_div = new Element('div').injectAfter(expertItems_div);
            var resume_label = new Element('label', {'for':'resume','class':'desc'})
                    .setHTML("<s:text name="user.personInfo.resume"></s:text>")
                    .injectInside(resume_div);
					//var req = new Element('span',{'class':'req'}).setHTML(" *").injectInside(resume_label);
            var resume_input = new Element('textarea', {'cols':'60','rows':'4','name':'personInfo.resume','id':'resume','class':'textarea'}).injectAfter(resume_label);

            dynCount++;
        }
    }

    var newTip = function(item) {
        new Tips(item, {
            fixed:false,
            maxTitleChars: 80,
            offsets:{'x':0,'y':22},
            onShow:function(t) {
                t.setStyle('opacity', 0.7);
                t.setStyle('display', '');
            }
        });
    }

    var inputTip = new Tips($ES("input", "login_panel"), {
        fixed:false,
        maxTitleChars: 80,
        offsets:{'x':0,'y':22},
        onShow:function(t) {
            t.setStyle('opacity', 0.7);
            t.setStyle('display', '');
        }
    });

    /*
      $('panes').getElements('input[type=radio]').each(function(item,index){
          item.addEvent('click',function(e){ e = new Event(e); jc++; if(jc*3%2==1) item.checked=true;
          else item.checked=false;
          e.stop(); }); });
    */

});

window.addEvent('load', function () {
    slidingtabs = new SlidingTabs('buttons', 'panes', {startingSlide: 'person'});
		// this sets up the previous/next buttons, if you want them
    // $('previous').addEvent('click', slidingtabs.previous.bind(slidingtabs));
    // $('next').addEvent('click', slidingtabs.next.bind(slidingtabs));
    // you can use one of these to selectively stop the user from changing to certain panes
    slidingtabs.addEvent('change', function(event) {
        //event.cancel = true;
    });
});

</script>